package opus

var dct_table = []float32{
	0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000,
	0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000,
	0.351851, 0.338330, 0.311806, 0.273300, 0.224292, 0.166664, 0.102631, 0.034654,
	-0.034654, -0.102631, -0.166664, -0.224292, -0.273300, -0.311806, -0.338330, -0.351851,
	0.346760, 0.293969, 0.196424, 0.068975, -0.068975, -0.196424, -0.293969, -0.346760,
	-0.346760, -0.293969, -0.196424, -0.068975, 0.068975, 0.196424, 0.293969, 0.346760,
	0.338330, 0.224292, 0.034654, -0.166664, -0.311806, -0.351851, -0.273300, -0.102631,
	0.102631, 0.273300, 0.351851, 0.311806, 0.166664, -0.034654, -0.224292, -0.338330,
	0.326641, 0.135299, -0.135299, -0.326641, -0.326641, -0.135299, 0.135299, 0.326641,
	0.326641, 0.135299, -0.135299, -0.326641, -0.326641, -0.135299, 0.135299, 0.326641,
	0.311806, 0.034654, -0.273300, -0.338330, -0.102631, 0.224292, 0.351851, 0.166664,
	-0.166664, -0.351851, -0.224292, 0.102631, 0.338330, 0.273300, -0.034654, -0.311806,
	0.293969, -0.068975, -0.346760, -0.196424, 0.196424, 0.346760, 0.068975, -0.293969,
	-0.293969, 0.068975, 0.346760, 0.196424, -0.196424, -0.346760, -0.068975, 0.293969,
	0.273300, -0.166664, -0.338330, 0.034654, 0.351851, 0.102631, -0.311806, -0.224292,
	0.224292, 0.311806, -0.102631, -0.351851, -0.034654, 0.338330, 0.166664, -0.273300,
}

var analysis_window = []float32{
	0.000043, 0.000171, 0.000385, 0.000685, 0.001071, 0.001541, 0.002098, 0.002739,
	0.003466, 0.004278, 0.005174, 0.006156, 0.007222, 0.008373, 0.009607, 0.010926,
	0.012329, 0.013815, 0.015385, 0.017037, 0.018772, 0.020590, 0.022490, 0.024472,
	0.026535, 0.028679, 0.030904, 0.033210, 0.035595, 0.038060, 0.040604, 0.043227,
	0.045928, 0.048707, 0.051564, 0.054497, 0.057506, 0.060591, 0.063752, 0.066987,
	0.070297, 0.073680, 0.077136, 0.080665, 0.084265, 0.087937, 0.091679, 0.095492,
	0.099373, 0.103323, 0.107342, 0.111427, 0.115579, 0.119797, 0.124080, 0.128428,
	0.132839, 0.137313, 0.141849, 0.146447, 0.151105, 0.155823, 0.160600, 0.165435,
	0.170327, 0.175276, 0.180280, 0.185340, 0.190453, 0.195619, 0.200838, 0.206107,
	0.211427, 0.216797, 0.222215, 0.227680, 0.233193, 0.238751, 0.244353, 0.250000,
	0.255689, 0.261421, 0.267193, 0.273005, 0.278856, 0.284744, 0.290670, 0.296632,
	0.302628, 0.308658, 0.314721, 0.320816, 0.326941, 0.333097, 0.339280, 0.345492,
	0.351729, 0.357992, 0.364280, 0.370590, 0.376923, 0.383277, 0.389651, 0.396044,
	0.402455, 0.408882, 0.415325, 0.421783, 0.428254, 0.434737, 0.441231, 0.447736,
	0.454249, 0.460770, 0.467298, 0.473832, 0.480370, 0.486912, 0.493455, 0.500000,
	0.506545, 0.513088, 0.519630, 0.526168, 0.532702, 0.539230, 0.545751, 0.552264,
	0.558769, 0.565263, 0.571746, 0.578217, 0.584675, 0.591118, 0.597545, 0.603956,
	0.610349, 0.616723, 0.623077, 0.629410, 0.635720, 0.642008, 0.648271, 0.654508,
	0.660720, 0.666903, 0.673059, 0.679184, 0.685279, 0.691342, 0.697372, 0.703368,
	0.709330, 0.715256, 0.721144, 0.726995, 0.732807, 0.738579, 0.744311, 0.750000,
	0.755647, 0.761249, 0.766807, 0.772320, 0.777785, 0.783203, 0.788573, 0.793893,
	0.799162, 0.804381, 0.809547, 0.814660, 0.819720, 0.824724, 0.829673, 0.834565,
	0.839400, 0.844177, 0.848895, 0.853553, 0.858151, 0.862687, 0.867161, 0.871572,
	0.875920, 0.880203, 0.884421, 0.888573, 0.892658, 0.896677, 0.900627, 0.904508,
	0.908321, 0.912063, 0.915735, 0.919335, 0.922864, 0.926320, 0.929703, 0.933013,
	0.936248, 0.939409, 0.942494, 0.945503, 0.948436, 0.951293, 0.954072, 0.956773,
	0.959396, 0.961940, 0.964405, 0.966790, 0.969096, 0.971321, 0.973465, 0.975528,
	0.977510, 0.979410, 0.981228, 0.982963, 0.984615, 0.986185, 0.987671, 0.989074,
	0.990393, 0.991627, 0.992778, 0.993844, 0.994826, 0.995722, 0.996534, 0.997261,
	0.997902, 0.998459, 0.998929, 0.999315, 0.999615, 0.999829, 0.999957, 1.000000,
}

var tbands = []int{
	2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 68, 80, 96, 120,
}

var extra_bands = []int{
	1, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 68, 80, 96, 120, 160, 200,
}

var weights = []float32{
	-0.0941125, -0.302976, -0.603555, -0.19393, -0.185983,
	-0.601617, -0.0465317, -0.114563, -0.103599, -0.618938,
	-0.317859, -0.169949, -0.0702885, 0.148065, 0.409524,
	0.548432, 0.367649, -0.494393, 0.764306, -1.83957,
	0.170849, 12.786, -1.08848, -1.27284, -16.2606,
	24.1773, -5.57454, -0.17276, -0.163388, -0.224421,
	-0.0948944, -0.0728695, -0.26557, -0.100283, -0.0515459,
	-0.146142, -0.120674, -0.180655, 0.12857, 0.442138,
	-0.493735, 0.167767, 0.206699, -0.197567, 0.417999,
	1.50364, -0.773341, -10.0401, 0.401872, 2.97966,
	15.2165, -1.88905, -1.19254, 0.0285397, -0.00405139,
	0.0707565, 0.00825699, -0.0927269, -0.010393, -0.00428882,
	-0.00489743, -0.0709731, -0.00255992, 0.0395619, 0.226424,
	0.0325231, 0.162175, -0.100118, 0.485789, 0.12697,
	0.285937, 0.0155637, 0.10546, 3.05558, 1.15059,
	-1.00904, -1.83088, 3.31766, -3.42516, -0.119135,
	-0.0405654, 0.00690068, 0.0179877, -0.0382487, 0.00597941,
	-0.0183611, 0.00190395, -0.144322, -0.0435671, 0.000990594,
	0.221087, 0.142405, 0.484066, 0.404395, 0.511955,
	-0.237255, 0.241742, 0.35045, -0.699428, 10.3993,
	2.6507, -2.43459, -4.18838, 1.05928, 1.71067,
	0.00667811, -0.0721335, -0.0397346, 0.0362704, -0.11496,
	-0.0235776, 0.0082161, -0.0141741, -0.0329699, -0.0354253,
	0.00277404, -0.290654, -1.14767, -0.319157, -0.686544,
	0.36897, 0.478899, 0.182579, -0.411069, 0.881104,
	-4.60683, 1.4697, 0.335845, -1.81905, -30.1699,
	5.55225, 0.0019508, -0.123576, -0.0727332, -0.0641597,
	-0.0534458, -0.108166, -0.0937368, -0.0697883, -0.0275475,
	-0.192309, -0.110074, 0.285375, -0.405597, 0.0926724,
	-0.287881, -0.851193, -0.099493, -0.233764, -1.2852,
	1.13611, 3.12168, -0.0699, -1.86216, 2.65292,
	-7.31036, 2.44776, -0.00111802, -0.0632786, -0.0376296,
	-0.149851, 0.142963, 0.184368, 0.123433, 0.0756158,
	0.117312, 0.0933395, 0.0692163, 0.0842592, 0.0704683,
	0.0589963, 0.0942205, -0.448862, 0.0262677, 0.270352,
	-0.262317, 0.172586, 2.00227, -0.159216, 0.038422,
	10.2073, 4.15536, -2.3407, -0.0550265, 0.00964792,
	-0.141336, 0.0274501, 0.0343921, -0.0487428, 0.0950172,
	-0.00775017, -0.0372492, -0.00548121, -0.0663695, 0.0960506,
	-0.200008, -0.0412827, 0.58728, 0.0515787, 0.337254,
	0.855024, 0.668371, -0.114904, -3.62962, -0.467477,
	-0.215472, 2.61537, 0.406117, -1.36373, 0.0425394,
	0.12208, 0.0934502, 0.123055, 0.0340935, -0.142466,
	0.035037, -0.0490666, 0.0733208, 0.0576672, 0.123984,
	-0.0517194, -0.253018, 0.590565, 0.145849, 0.315185,
	0.221534, -0.149081, 0.216161, -0.349575, 24.5664,
	-0.994196, 0.614289, -18.7905, -2.83277, -0.716801,
	-0.347201, 0.479515, -0.246027, 0.0758683, 0.137293,
	-0.17781, 0.118751, -0.00108329, -0.237334, 0.355732,
	-0.12991, -0.0547627, -0.318576, -0.325524, 0.180494,
	-0.0625604, 0.141219, 0.344064, 0.37658, -0.591772,
	5.8427, -0.38075, 0.221894, -1.41934, -1.87943e+06,
	1.34114, 0.0283355, -0.0447856, -0.0211466, -0.0256927,
	0.0139618, 0.0207934, -0.0107666, 0.0110969, 0.0586069,
	-0.0253545, -0.0328433, 0.11872, -0.216943, 0.145748,
	0.119808, -0.0915211, -0.120647, -0.0787719, -0.143644,
	-0.595116, -1.152, -1.25335, -1.17092, 4.34023,
	-975268.0, -1.37033, -0.0401123, 0.210602, -0.136656,
	0.135962, -0.0523293, 0.0444604, 0.0143928, 0.00412666,
	-0.0193003, 0.218452, -0.110204, -2.02563, 0.918238,
	-2.45362, 1.19542, -0.061362, -1.92243, 0.308111,
	0.49764, 0.912356, 0.209272, -2.34525, 2.19326,
	-6.47121, 1.69771, -0.725123, 0.0118929, 0.0377944,
	0.0554003, 0.0226452, -0.0704421, -0.0300309, 0.0122978,
	-0.0041782, -0.0686612, 0.0313115, 0.039111, 0.364111,
	-0.0945548, 0.0229876, -0.17414, 0.329795, 0.114714,
	0.30022, 0.106997, 0.132355, 5.79932, 0.908058,
	-0.905324, -3.3561, 0.190647, 0.184211, -0.673648,
	0.231807, -0.0586222, 0.230752, -0.438277, 0.245857,
	-0.17215, 0.0876383, -0.720512, 0.162515, 0.0170571,
	0.101781, 0.388477, 1.32931, 1.08548, -0.936301,
	-2.36958, -6.71988, -3.44376, 2.13818, 14.2318,
	4.91459, -3.09052, -9.69191, -0.768234, 1.79604,
	0.0549653, 0.163399, 0.0797025, 0.0343933, -0.0555876,
	-0.00505673, 0.0187258, 0.0326628, 0.0231486, 0.15573,
	0.0476223, -0.254824, 1.60155, -0.801221, 2.55496,
	0.737629, -1.36249, -0.695463, -2.44301, -1.73188,
	3.95279, 1.89068, 0.486087, -11.3343, 3.9416e+06,
	-0.381439, 0.12115, -0.906927, 2.93878, 1.6388,
	0.882811, 0.874344, 1.21726, -0.874545, 0.321706,
	0.785055, 0.946558, -0.575066, -3.46553, 0.884905,
	0.0924047, -9.90712, 0.391338, 0.160103, -2.04954,
	4.1455, 0.0684029, -0.144761, -0.285282, 0.379244,
	-1.1584, -0.0277241, -9.85, -4.82386, 3.71333,
	3.87308, 3.52558,
}

var topo = []int{25, 15, 2}

var Tansig_table = []float32{
	0.000000, 0.039979, 0.079830, 0.119427, 0.158649,
	0.197375, 0.235496, 0.272905, 0.309507, 0.345214,
	0.379949, 0.413644, 0.446244, 0.477700, 0.507977,
	0.537050, 0.564900, 0.591519, 0.616909, 0.641077,
	0.664037, 0.685809, 0.706419, 0.725897, 0.744277,
	0.761594, 0.777888, 0.793199, 0.807569, 0.821040,
	0.833655, 0.845456, 0.856485, 0.866784, 0.876393,
	0.885352, 0.893698, 0.901468, 0.908698, 0.915420,
	0.921669, 0.927473, 0.932862, 0.937863, 0.942503,
	0.946806, 0.950795, 0.954492, 0.957917, 0.961090,
	0.964028, 0.966747, 0.969265, 0.971594, 0.973749,
	0.975743, 0.977587, 0.979293, 0.980869, 0.982327,
	0.983675, 0.984921, 0.986072, 0.987136, 0.988119,
	0.989027, 0.989867, 0.990642, 0.991359, 0.992020,
	0.992631, 0.993196, 0.993718, 0.994199, 0.994644,
	0.995055, 0.995434, 0.995784, 0.996108, 0.996407,
	0.996682, 0.996937, 0.997172, 0.997389, 0.997590,
	0.997775, 0.997946, 0.998104, 0.998249, 0.998384,
	0.998508, 0.998623, 0.998728, 0.998826, 0.998916,
	0.999000, 0.999076, 0.999147, 0.999213, 0.999273,
	0.999329, 0.999381, 0.999428, 0.999472, 0.999513,
	0.999550, 0.999585, 0.999617, 0.999646, 0.999673,
	0.999699, 0.999722, 0.999743, 0.999763, 0.999781,
	0.999798, 0.999813, 0.999828, 0.999841, 0.999853,
	0.999865, 0.999875, 0.999885, 0.999893, 0.999902,
	0.999909, 0.999916, 0.999923, 0.999929, 0.999934,
	0.999939, 0.999944, 0.999948, 0.999952, 0.999956,
	0.999959, 0.999962, 0.999965, 0.999968, 0.999970,
	0.999973, 0.999975, 0.999977, 0.999978, 0.999980,
	0.999982, 0.999983, 0.999984, 0.999986, 0.999987,
	0.999988, 0.999989, 0.999990, 0.999990, 0.999991,
	0.999992, 0.999992, 0.999993, 0.999994, 0.999994,
	0.999994, 0.999995, 0.999995, 0.999996, 0.999996,
	0.999996, 0.999997, 0.999997, 0.999997, 0.999997,
	0.999997, 0.999998, 0.999998, 0.999998, 0.999998,
	0.999998, 0.999998, 0.999999, 0.999999, 0.999999,
	0.999999, 0.999999, 0.999999, 0.999999, 0.999999,
	0.999999, 0.999999, 0.999999, 0.999999, 0.999999,
	1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
	1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
	1.000000,
}

var MONO_VOICE_BANDWIDTH_THRESHOLDS = []int{
	11000, 1000,
	14000, 1000,
	17000, 1000,
	21000, 2000,
}

var MONO_MUSIC_BANDWIDTH_THRESHOLDS = []int{
	12000, 1000,
	15000, 1000,
	18000, 2000,
	22000, 2000,
}

var STEREO_VOICE_BANDWIDTH_THRESHOLDS = []int{
	11000, 1000,
	14000, 1000,
	21000, 2000,
	28000, 2000,
}

var STEREO_MUSIC_BANDWIDTH_THRESHOLDS = []int{
	12000, 1000,
	18000, 2000,
	21000, 2000,
	30000, 2000,
}

const stereo_voice_threshold = 30000
const stereo_music_threshold = 30000

var mode_thresholds = [][]int{
	{64000, 16000},
	{36000, 16000},
}

var OpusTables = struct {
	Dct_table       []float32
	Net             *MLPState
	Tbands          []int
	Extra_bands     []int
	Analysis_window []float32
	MODE_THRESHOLDS [][]int
}{
	Dct_table:       dct_table,
	Tbands:          tbands,
	Extra_bands:     extra_bands,
	Analysis_window: analysis_window,
	MODE_THRESHOLDS: mode_thresholds,
	Net: &MLPState{
		layers:  3,
		topo:    topo,
		weights: weights,
	},
}
